package org.hard.model.create.singleton;

import java.util.Objects;

/**
 * @author: 王林博
 * @date: 2023年02月16日 11:08
 */
public class Singleton {


    private static Singleton singleton;

    private Singleton(){

    }

    public static Singleton getInstance(){
        if(Objects.isNull(singleton)){
            singleton = new Singleton();
        }
        System.out.println();
        return singleton;
    }

    public void print(){
        System.out.println("123");
    }

    public static void main(String[] args) {
        final Singleton instance = Singleton.getInstance();
        instance.print();

    }
}
